<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>media</title>
<link rel="stylesheet" type="text/css" href="../resource/css/screen.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery-1.4.2.js"></script>
</head>

<body>
    <div class="wrap">
         <div class="header">
              <div class="logo">
                 <a href="#"><img alt="logo" src="../resource/images/brand.gif" /></a>
              </div>
              
         </div>
         <div class="content_show">
             <div class="sidebar_show">
                 <img src="../resource/images/images_info.gif" alt="图片信息" />
                 <dl>
                     <input type="hidden" name="id" value="${object.id}">
                     <input type="hidden" name="url" value="${pageContext.request.contextPath}/sz/${actionName}.action" />
                    <dt>文件名称</dt>
                    <dd id="pic_name"><span>${object.title}</span><input style="display:none;" type="text" name="title" value="${object.title}" /></dd>
                    <dt>文件格式</dt>
                    <dd>${object.fileType}</dd>
                    <dt>文件大小</dt>
                    <dd>${object.size}KB</dd>
                    <c:choose>
                       <c:when test="${!empty object.disrate}">
                         <dt>分辨率</dt>
                         <dd>${object.disrate}</dd>
                     </c:when>
                    </c:choose>
                    <dt>站点</dt>
                    <dd>${object.server}</dd>
                    <dt>描述</dt>
                    <dd id="pic_note"><span>${object.note}</span><textarea style="display:none;" type="text" name="note" value="${object.note}">${object.note}</textarea></dd>
                 </dl>
                 <p id="PdetailSub" class="PdetailSub">
                 	<a id="modify_mess"  title="modify" href="">修改</a>
                 	<a id="submit_mess" style="display:none;" href="">确定</a>
                 	<a id="detele_mess" title="delete" href="${pageContext.request.contextPath}/sz/delete${actionName}.action?id=${object.id}">删除</a>
                 </p>
              </div>
             <div class="big_show">
                 <c:choose>
                     <c:when test="${!empty object.pictureUrl}">
                         <img alt="img" src="${object.pictureUrl}" />
                     </c:when>
                     <c:when test="${empty object.minPictureUrl}">
                         <img alt="img" src="../resource/images/audio_show.jpg" />
                     </c:when>
                     <c:otherwise>
                         <img alt="img" src="${object.minPictureUrl}" />
                     </c:otherwise>
                 </c:choose>
             </div>
         </div>
         
         <div class="footer">
           <span>&copy;</span><span>电子科技大学数字媒体技术研究所</span><span>All rights reserved</span>
           <span>&#124;</span><span>Powered by Dreamfly</span>
         </div>
    </div>
    <script>
    $(document).ready(function(){
    	$("#modify_mess").click(function(){
    		$("#pic_name").find("span").hide();
    		$("#pic_name").find("input").show();
    		$("#pic_note").find("span").hide();
    		$("#pic_note").find("textarea").show();
    		this.style.display="none";
    		$("#submit_mess").show();
    		return false;
    	});
    	$("#detele_mess").click(function(){
    		var url=this.href.replace("modify","");
    		$.ajax({
    			type:"GET",
    			url:url,
    			datatype:"text",
    			success:function(data){
    				if(data=="success"){
    					alert("删除成功！");
    					window.history.back()
    				}
    			}
    		});
    		return false;
    	});
    	$("#submit_mess").click(function(){
    		var picid=$("input[name=id]").val();
    		var pictitle=$("input[name=title]").val();
    		var picnote=$("textarea[name=note]").val();
    		var url=$("input[name=url]").val();
            if(pictitle.length >= 20 || picnote.length>=300){
                alert("文件名称过长或描述过长");
                return false;
            }
    		$.ajax({
    			type:"POST",
    			url:url,
    			dataType:"text",
    			data:{
    				id:picid,
    				title:pictitle,
    				note:picnote
    			},
    			success:function(data){
    				if(data=="success"){
    					$("#pic_name").find("span").text(pictitle).show();
    					$("#pic_name").find("input").val(pictitle).hide();
    					$("#pic_note").find("span").text(picnote).show();
    					$("#pic_note").find("textarea").val(picnote).hide();
    					$("#submit_mess").hide();
    					$("#modify_mess").show();
    				}
    			}
    		});
    		return false; 
    	});
    });
  </script>   
</body>
</html>
